from flask import Flask,render_template,url_for,request,jsonify
from flask.views import View
app=Flask(__name__)
class BaseView(View):
    def __init__(self):
        self.mess={'main':"百战课程有更新了！！！"}

class LoginView(BaseView):
    def dispatch_request(self):
        my_msg='神奇的登录功能~~'
        self.mess['my_msg']=my_msg
        return render_template('first_flask/login.html',**self.mess)
class RegisterView(BaseView):
    def dispatch_request(self):
        my_msg='生气的注册功能'
        self.mess['my_msg']=my_msg
        return render_template('first_flask/register.html',**self.mess)

app.add_url_rule(rule='/base/',endpoint='ba',view_func=BaseView.as_view('ba'))
app.add_url_rule(rule='/login/',endpoint='login',view_func=LoginView.as_view('login'))
app.add_url_rule(rule='/register/',endpoint='register',view_func=RegisterView.as_view('register'))

if __name__=="__main__":
    app.run(debug=True)